import 'package:flutter/cupertino.dart';
import 'package:flutter_basic_learning/utils/CommonWidget.dart';
import 'package:flutter_basic_learning/views/getx/getx_binding/GetxBindingPageTwo.dart';
import 'package:get/get.dart';

import '../getx_controller/DataShareController.dart';

class GetxBindingPageOne extends StatelessWidget {
  const GetxBindingPageOne({super.key});

  @override
  Widget build(BuildContext context) {
    return commonScaffold('全局数据共享 - 页面1', [
      Obx(() =>
          commonText('全局数据共享： ${Get.find<DataShareController>().count.value}')),
      commonButton('count+1', () {
        Get.find<DataShareController>().count.value++;
      }),
      commonButton('跳转页面2', () {
        Get.to(() => GetxBindingPageTwo());
      })
    ]);
  }
}
